export function contentToHighlight(obj) {
  const color = '#4a8cd9';
  const sentence = obj.sentence.split('');
  const errorsObj = {};
  const { errors } = obj;
  errors.forEach((item) => {
    errorsObj[item.idx] = item;
  });

  const content = sentence.map((item, index) => {
    if (errorsObj[index]) {
      return `<span style="color:${color}">${item}</span>`;
    }
    return item;
  });
  return content.reduce((accumulator, currentValue) => accumulator + currentValue);
}
